<template>
  <transition name="fade">
    <div v-if="show" class="message-toast">
      {{ message }}
    </div>
  </transition>
</template>

<script>
export default {
  name: 'MessageToast',
  data() {
    return {
      show: false,
      message: ''
    };
  },
  methods: {
    showMessage(msg) {
      this.message = msg;
      this.show = true;
      setTimeout(() => {
        this.show = false;
      }, 3000);
    }
  }
};
</script>

<style scoped>
.message-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  z-index: 9999;
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s;
}

.fade-enter,
.fade-leave-to {
  opacity: 0;
}
</style>
